<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jstl/fmt" prefix="f" %>
<%@ include file="prelude.jsp" %>
<!DOCTYPE HTML PUBLIC  "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
  <head>
    <meta http-equiv="content-type" content="text/html; charset=UTF-8">
    <title><c:out value="${forumName}"/></title>
    <link type="text/css" rel="stylesheet" href='<c:out value="${forumPath}"/>base.css'>
    <c:if test="${not empty user_id}">
      <script type="text/javascript" language="javascript"
              src="/com.bardsoftware.foronuvolo.AnswersView/com.bardsoftware.foronuvolo.AnswersView.nocache.js"></script>
    </c:if>
  </head>
<body id=root>
<jsp:include page="all_authservices_init.jsp"/>
<div id=body>

<c:import url="page_header.jsp"/>

<div id=content>
  <div id=sidebar>
    <div class="sidebaritem">
      <jsp:include page="format_menu.jsp"/>
    </div>
<br>
<br>
    <div class="sidebaritem">
      <div class="sidebarheader roundtop">You are</div>
      <div class="sidebarcontent">
        <c:set var="nickname" scope="request" value="${nickname}"/>
        <c:set var="user_id" scope="request" value="${user_id}"/>
        <c:set var="opera" scope="request" value="${opera}"/>
        <jsp:include page="format_personal_info.jsp"/>
      </div>
    </div>
  </div>
  <div class=main_content>
      <div class="localnav">
        &nbsp;
        <jsp:include page="format_all_hot.jsp"/>
      </div>
      <div id="initial">
        <c:set var="nickname" scope="request" value="${discussion.username}"/>
        <c:set var="message" scope="request" value="${discussion.text}"/>
        <c:set var="date" scope="request" value="${discussion.startDate}"/>
        <c:set var="myvar" value="${discussion.longID}"/>
        <c:set var="rat" scope="request" value="${discussion.rating}" />
        
        <c:if test="${not empty user_id}">
        	<form method="GET" action="/changeRating.jsp">
        		<button name="like" value="1" type="submit"><img src="/img/arrow_up.png" alt="good discussion"></button>
        		<button name="like" value="-1" type="submit"><img src="/img/arrow_down.png" alt="bad discussion"></button>        		
        		<input type="hidden" name="UserId" value="<c:out value="${user_id}"/>"/>
        		<input type="hidden" name="id" value="<c:out value="${myvar}"/>"/>
        	</form>
        </c:if>
        <b>Rating: <c:out value="${rat}" /></b>        
        <jsp:include page="format_comment.jsp"/>
    </div>
    <div id=answers_header>
      <c:if test="${discussion.replyCount > 0}">
        <c:set var="number" scope="request" value="${discussion.replyCount}"/>
        <jsp:include page="format_answers_count.jsp"/>
      </c:if>
    </div>
    <c:if test="${discussion.replyCount > 0}">
    <c:forEach var="message" items="${messages}">
      <jsp:useBean id="message" type="com.bardsoftware.foronuvolo.data.AnswersViewItem"/>
        <c:set var="nickname" scope="request" value="${message.userDisplayName}"/>
        <c:set var="message" scope="request" value="${message.text}"/>
        <c:set var="date" scope="request" value="${message.creation}"/>
        <jsp:include page="format_comment.jsp"/>
    </c:forEach>
    </c:if>
    <c:if test="${not empty user_id}">
        <div id="new_comment_output"></div>
        <div class=comment_header>add comment</div>
        <div class=editor id="new_comment"></div>
        <div id="send_button"></div>
        <div id="err_notifier">Server error. Try again in  few seconds.</div>
    </c:if>
  </div>
</div>  <!-- content -->
</div>  <!-- body -->
</body>
</html>